importScripts(
  "https://g.alicdn.com/mylib/lp-workbox-cdn/3.6.3-2/workbox/workbox-sw.js"
);

workbox.setConfig({
  debug: false,
});
workbox.core.setLogLevel(workbox.core.LOG_LEVELS.debug);

workbox.skipWaiting();
workbox.clientsClaim();

workbox.precaching.suppressWarnings(false);
workbox.precaching.precacheAndRoute([]);

workbox.routing.registerRoute(
  /.+\.(js|css)$/i,
  workbox.strategies.staleWhileRevalidate({
    cacheName: "res",
    plugins: [
      {
        requestWillFetch: ({ event }) => {
          return new Request(event.request.url + '?t=' + Date.now(), {
            mode: "cors",
          });
        },
      },
    ],
  }),
  "GET"
);
